Lecture 08

Embedded Programming

Learning about C programming:

Iam very new for electronics, and Embedded programming but its very nice experience of Electronic design and programming of it.

For embedded programming Me n Yogesh thought that we will make one board which can remind us of drinking water after every 45 minutes.

So for that Yogesh made a one PCB desing on Eagle with 4 led's ans small battery.


Started the learning about the C programming.

Its very new learning thing for me Binary and Decimal Bits.



As well as working with pcb and soldering.



We use the ATtiny45 Ic.


I'm using avr programmer as programmer.


To write a programm for any microcontroller its must to read datasheet first and then write as per. Datasheet helps to understand process and working of that controller.



But the data sheet is "258 pages" ohh my god for me its very difficult to read those many pages and understand the coding language, So yogesh explain it to me lot.


A video which will gives you idea about the codes and AVR programmer for beginners.


First one minute Trial program

Then i started the main program which is start blinking after every 45 minutes and after pressing the button led blinking will stoppes and fron there rotation circle continues.


This is main code


#include
#include

int i =10;

void aMinute(int min){
char i = 0,j=0;
for(j=1;j<=min;j++){
for(i=1;i<=12;i++){ //delay toop generating approximately A minute
_delay_ms(4970);
}
}
}

int main(void){
DDRB = 0xF7;
while(1){
aMinute(45);

while(1){
PORTB = 0xff;
_delay_ms(100);
PORTB = 0x00;
_delay_ms(100);
if((PINB & 0x08) == 0x00){
break;
}
}
}

return 0;
}


To upload this programm on hello world board I used avr programmer as a programmer.

To connecting the avr programmmer i just installed the gedit plugins.



Then on terminal into gedit just gives command of "sudo make program" and yes here is the programmer done.


Small video of led's blinking.


45 minutes program




This is a main files of pcb

Board Interiol Traces